/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package transervfx.Logica;

import java.util.List;
import transervfx.Dato.DAO.TramiteDAO;
import transervfx.Dato.Entidad.Tramite;

/**
 *
 * @author meli
 */
public class GestorTramite {

    private static GestorTramite INSTANCE = null;

    public GestorTramite() {
    }

    private synchronized static void createInstance() {
        if (INSTANCE == null) {
            INSTANCE = new GestorTramite();
        }
    }

    public static GestorTramite getInstance() {
        if (INSTANCE == null) {
            createInstance();
        }
        return INSTANCE;
    }

    public void guardarEncomienda(Tramite t) {
        TramiteDAO.getInstance().persist(t);
    }

    public void actualizarEncomienda(Tramite t) {
        TramiteDAO.getInstance().update(t);
    }

    public void eliminarEncomienda(Tramite t){
        TramiteDAO.getInstance().remove(t);
    }

    
    public List<Tramite> findAll() {
        return TramiteDAO.getInstance().findAll();
    }

    public Tramite findByCompleto(Tramite tramiteSeleccionado) {
        return TramiteDAO.getInstance().findByCompleto(tramiteSeleccionado);
    }
    
       public Long numeroDeTramitesFiltrados() {
        return TramiteDAO.getInstance().numeroDeTramitesFiltrados();
    }

    public List<Tramite> tramitesPendienteEntrega(int ini, int fin) {
        return TramiteDAO.getInstance().tramitesPendienteEntregaRango(ini, fin);
    }
}
